package com.yanqu.road.entity.activity.washe.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_washe_history")
public class WasheHistory extends DataObject {

    @FieldTypeAnnotation(desc = "玩家ID", select = true, update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "每个赛季的数据")
    private ConcurrentHashMap<Integer, ConcurrentHashMap<Integer, WasheHistoryTemp>> seasonHistoryTempMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "所有赛季公用的数据")
    private ConcurrentHashMap<Integer, WasheHistoryTemp> historyTempMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "最后一局的数据")
    private ConcurrentHashMap<Integer, WasheHistoryTemp> lastGameHistoryTempMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "卡片使用次数")
    private ConcurrentHashMap<Integer, Long> cardUseTimesMap = new ConcurrentHashMap<>();

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public ConcurrentHashMap<Integer, ConcurrentHashMap<Integer, WasheHistoryTemp>> getSeasonHistoryTempMap() {
        return seasonHistoryTempMap;
    }

    public void setSeasonHistoryTempMap(ConcurrentHashMap<Integer, ConcurrentHashMap<Integer, WasheHistoryTemp>> seasonHistoryTempMap) {
        if (null == seasonHistoryTempMap) {
            return;
        }
        if (this.seasonHistoryTempMap == null || !this.seasonHistoryTempMap.equals(seasonHistoryTempMap)) {
            this.seasonHistoryTempMap = seasonHistoryTempMap;
            setOp(DataStatus.Update);
        }
    }

    public ConcurrentHashMap<Integer, WasheHistoryTemp> getHistoryTempMap() {
        return historyTempMap;
    }

    public void setHistoryTempMap(ConcurrentHashMap<Integer, WasheHistoryTemp> historyTempMap) {
        if (null == historyTempMap) {
            return;
        }
        if (this.historyTempMap == null || !this.historyTempMap.equals(historyTempMap)) {
            this.historyTempMap = historyTempMap;
            setOp(DataStatus.Update);
        }
    }

    public ConcurrentHashMap<Integer, WasheHistoryTemp> getLastGameHistoryTempMap() {
        return lastGameHistoryTempMap;
    }

    public void setLastGameHistoryTempMap(ConcurrentHashMap<Integer, WasheHistoryTemp> lastGameHistoryTempMap) {
        if (null == lastGameHistoryTempMap) {
            return;
        }
        if (this.lastGameHistoryTempMap == null || !this.lastGameHistoryTempMap.equals(lastGameHistoryTempMap)) {
            this.lastGameHistoryTempMap = lastGameHistoryTempMap;
            setOp(DataStatus.Update);
        }
    }

    public Map<Integer, Long> getCardUseTimesMap() {
        return cardUseTimesMap;
    }

    public void setCardUseTimesMap(ConcurrentHashMap<Integer, Long> cardUseTimesMap) {
        if (cardUseTimesMap == null) {
            return;
        }
        if (!Objects.equals(this.cardUseTimesMap, cardUseTimesMap)) {
            this.cardUseTimesMap = cardUseTimesMap;
            setUpdateOption();
        }
    }
}
